<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the set of backends that are embeddable in other event loops</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ev.depth.html">« Ev::depth</a></li>
      <li style="float: right;"><a href="ev.feedsignal.html">Ev::feedSignal »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.ev.html">Ev</a></li>
    <li>Returns the set of backends that are embeddable in other event loops</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ev.embeddablebackends" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ev::embeddableBackends</h1>
  <p class="verinfo">(PECL ev &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">Ev::embeddableBackends</span> &mdash; <span class="dc-title">Returns the set of backends that are embeddable in other event loops</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ev.embeddablebackends-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><strong>Ev::embeddableBackends</strong></span>(): <span class="type">int</span></div>

  <p class="para rdfs-comment">
   Returns the set of backends that are embeddable in other event loops.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-ev.embeddablebackends-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-ev.embeddablebackends-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a bit mask which can containing
   <a href="class.ev.html#ev.constants.watcher-backends" class="link">backend flags</a>
   combined using bitwise
   <em class="emphasis">OR</em>
   operator.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-ev.embeddablebackends-examples">
  <h3 class="title">范例</h3>
 <div class="example" id="example-3255">
   <p><strong>示例 #1 Embedding loop created with kqueue backend into the default loop</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*<br />*&nbsp;Check&nbsp;if&nbsp;kqueue&nbsp;is&nbsp;available&nbsp;but&nbsp;not&nbsp;recommended&nbsp;and&nbsp;create&nbsp;a&nbsp;kqueue&nbsp;backend<br />*&nbsp;for&nbsp;use&nbsp;with&nbsp;sockets&nbsp;(which&nbsp;usually&nbsp;work&nbsp;with&nbsp;any&nbsp;kqueue&nbsp;implementation).<br />*&nbsp;Store&nbsp;the&nbsp;kqueue/socket-only&nbsp;event&nbsp;loop&nbsp;in&nbsp;loop_socket.&nbsp;(One&nbsp;might&nbsp;optionally<br />*&nbsp;use&nbsp;EVFLAG_NOENV,&nbsp;too)<br />*<br />*&nbsp;Example&nbsp;borrowed&nbsp;from<br />*&nbsp;http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9<br />*/<br /></span><span style="color: #0000BB">$loop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">EvLoop</span><span style="color: #007700">::</span><span style="color: #0000BB">defaultLoop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$socket_loop&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$embed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /><br />if&nbsp;(</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">supportedBackends</span><span style="color: #007700">()&nbsp;&amp;&nbsp;~</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">recommendedBackends</span><span style="color: #007700">()&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">BACKEND_KQUEUE</span><span style="color: #007700">)&nbsp;{<br />&nbsp;if&nbsp;((</span><span style="color: #0000BB">$socket_loop&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EvLoop</span><span style="color: #007700">(</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">BACKEND_KQUEUE</span><span style="color: #007700">)))&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$embed&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EvEmbed</span><span style="color: #007700">(</span><span style="color: #0000BB">$loop</span><span style="color: #007700">);<br />&nbsp;}<br />}<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$socket_loop</span><span style="color: #007700">)&nbsp;{<br />&nbsp;</span><span style="color: #0000BB">$socket_loop&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$loop</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Now&nbsp;use&nbsp;$socket_loop&nbsp;for&nbsp;all&nbsp;sockets,&nbsp;and&nbsp;$loop&nbsp;for&nbsp;anything&nbsp;else<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 <div class="refsect1 seealso" id="refsect1-ev.embeddablebackends-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">
    <span class="classname"><a href="class.evembed.html" class="classname">EvEmbed</a></span>
   </li>
   <li class="member">
    <span class="methodname"><a href="ev.recommendedbackends.html" class="methodname" rel="rdfs-seeAlso">Ev::recommendedBackends()</a> - Returns a bit mask of recommended backends for current
  platform</span>
   </li>
   <li class="member">
    <span class="methodname"><a href="ev.supportedbackends.html" class="methodname" rel="rdfs-seeAlso">Ev::supportedBackends()</a> - Returns the set of backends supported by current libev
  configuration</span>
   </li>
   <li class="member">
    <a href="class.ev.html#ev.constants.watcher-backends" class="link">Backend flags</a>
   </li>
   <li class="member">
    <a href="ev.examples.html" class="link">Examples</a>
   </li>
  </ul>
 </div>

</div></div></div></body></html>